package cn.edu.scau.cmi.linzhiyang.client;

import java.io.IOException;

import cn.edu.scau.cmi.linzhiyang.userInterface.ConsistentCompositeController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class ConsistentCompositeClient extends Application{
	
	private Stage primaryStage;
	
	@Override
	public void start(Stage primaryStage) {
		this.primaryStage = primaryStage;
		this.primaryStage.setTitle("实验五：一致性组合模式");
			
		showMainview();
	}
	
	/**
	 * Shows the main view
	 */
	public void showMainview() {
		try {
			// Load person overview.
            FXMLLoader loader = new FXMLLoader();
            loader.setLocation(ConsistentCompositeClient.class.getResource("../userInterface/ConsistentComposite.fxml"));
            AnchorPane mainView = (AnchorPane) loader.load();
            
            Scene scene = new Scene(mainView);
            primaryStage.setScene(scene);
            
            //Give the controller access to the main app.
            ConsistentCompositeController controller = loader.getController();
            controller.setMainApp(this);
            
            primaryStage.show();
		}catch (IOException e) {
			e.printStackTrace();
		}
	}

	
	/**
     * Returns the main stage.
     * @return
     */
    public Stage getPrimaryStage() {
        return primaryStage;
    }
	
	public static void main(String[] args) {
		launch(args);
	}
}